/*
 *
 *
Copyright (c) 1998-2001 Aristar, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. The end-user documentation included with the redistribution, if any,
must include the following acknowledgment:

"This product includes software developed by Aristar, Inc. (http://www.aristar.com/)."

Alternately, this acknowledgment may appear in the software itself, if and
wherever such third-party acknowledgments normally appear.

4. The names "Dialect" and "Aristar, Inc." must not be used to endorse or
promote products derived from this software without prior written permission.
For written permission, please contact info@aristar.com.

5. Products derived from this software may not be called "Dialect", nor may
"Dialect" appear in their name, without prior written permission of Aristar, Inc.

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
ARISTAR, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This software consists of voluntary contributions made by many individuals
on behalf of Aristar, Inc.  For more information on Aristar, Inc.,
please see <http://www.aristar.com/>.

Portions of this software are based upon software freely available and
written by individuals not associated with Aristar, Inc.  Copyrights are
maintained in the relevant source code files.
 *
 *
 */

// QWindow.h : header file

#if !defined(QWINDOW_H)
#define QWINDOW_H

#pragma once

/////////////////////////////////////////////////////

#define QW_EXIT			0
#define QW_OPEN			1
#define QW_CLOSE		2
#define QW_DESTROY		3
#define QW_RESIZE		4
#define QW_VISIBLE		5

#define QW_KEYPRESS		7
#define QW_CLICK		8
#define QW_RCLICK		9
#define QW_DOUBLECLICK	10
#define QW_MOUSEMOVE	11
#define QW_BUTTONDOWN	12
#define QW_BUTTONUP		13
#define QW_TIMER		14
#define QW_HOTKEY		15

#define QW_CHANGE		20
#define QW_UPDATE		21
#define QW_FOCUS		22
#define QW_UNFOCUS		23
#define QW_MENUSELECT	24
#define QW_INITMENU		25
#define QW_SCROLL		26
#define QW_HSCROLL		27
#define QW_VSCROLL		28
#define QW_PAINT		29

#define QW_SELCHANGE	30	// Listboxes, calendars

#define QW_ITEMINFO		40	// Layouts (control-shift-click)

/////////////////////////////////////////////////////

extern COLORREF	   g_White;
extern COLORREF	   g_Black;
extern COLORREF	   g_LightGray;
extern COLORREF	   g_DarkGray;
extern COLORREF	   g_BackgroundColor;

extern CFont	   g_QEditFont;
extern CFont	   g_QLabelFont;

#include "..\DialectLib\CValue.h"

#if defined(UNDER_CE) && (UNDER_CE <= 200)
#define QWS_MINBOX		0
#define QWS_MAXBOX		0
#else
#define QWS_MINBOX		WS_MINIMIZEBOX
#define QWS_MAXBOX		WS_MAXIMIZEBOX
#endif
#define QWS_CLOSEBOX	WS_SYSMENU
#define QWS_RESIZABLE	WS_BORDER // Set WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE on create
#define QWS_VISIBLE		WS_VISIBLE
#define QWS_TITLEBAR	WS_CAPTION
#define QWS_EX_TOPMOST	WS_EX_TOPMOST

class CQBase {
public:
	CQBase(VALUE vSelf);
	VALUE GetSelf();
protected:
	CClassInstImpl* m_pCI;
};

class CQWindow : public CWnd, public CQBase
{
// Construction
public:
	CQWindow(CString label, RECT& rc, int options, int exOptions,
		VALUE (*pHandler)(CQWindow*, int, VALUE), VALUE vSelf);

	VALUE (*m_pHandler)(CQWindow*, int, VALUE);

// Attributes
public:

// Operations
public:

// Overrides
	//{{AFX_VIRTUAL(CQWindow)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
public:
	void SetSize(CRect rect);
	CRect GetSize();
	virtual ~CQWindow();

protected:
	//{{AFX_MSG(CQWindow)
	afx_msg void OnClose();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
	afx_msg void OnPaint();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnTimer(UINT nIDEvent);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}

#endif
